#!/usr/bin/env python3
# -*- coding: utf-8 -*-

'''
page vo
'''
__author__ = "HymanHu";

class Result(object):
    def __init__(self, status, message, data=None):
        self.status = status;
        self.message = message;
        self.data = data;

class Page(object):
    def __init__(self, current_page, page_size, total, list):
        self.current_page = current_page;
        self.page_size = page_size;
        self.total = total;
        self.list = list;

class Search(object):
    def __init__(self, current_page, page_size, keyword, order_by, direction):
        self.current_page = current_page;
        self.page_size = page_size;
        self.keyword = keyword;
        self.order_by = order_by;
        self.direction = direction;

    def init_search(self):
        if not self.order_by:
            self.order_by = "id";
        if self.direction and str(self.direction).lower() == "desc":
            self.order_by = "-%s" % (self.order_by,);
        if not self.current_page:
            self.current_page = 1;
        if not self.page_size:
            self.page_size = 5;